package org.testis.services;

import org.testis.data.TestStepException;
import org.testis.data.TestStepResultType;


/**
 * A factory class to create a action factory object dynamically 
 * according to module type
 * @author nurhat
 */
public class AtofModuleActionFactoryCreator
{

    public AtofModuleActionFactory getInstance(String moduleType)
    {
        try {

            Class<?> cls =
                Class.forName("org.testis." + moduleType.toLowerCase() +
                              ".services." + moduleType + "ActionFactory");
            return (AtofModuleActionFactory) cls.newInstance();
        } catch (Exception ex) {
            throw new TestStepException(TestStepResultType.MISTAKE,
                                        "(" + ex.getClass().getSimpleName() +
                                        ")Given module type" + moduleType +
                                        " is not supported righ now at AtofModuleActionFactoryCreator");

        }

    }
}
